## set the arch you're building for
#export A=i386
#export A=x86_64
#export A=x86_64-x32
#export A=arm
#export A=mips
#export A=powerpc
#export A=microblaze
#export A=sh

[ -z "$A" ] && { printf "ERROR: no arch set\n" ; exit 1 ; }

# set BRUTE to 1 to enable LTO in the standard etc/butch-optflags profile
# (slow to compile, but results in minimal binary size and very fast code)
#export BRUTE=1
# set TESTBUILD to build everything without optimization/debug (much faster)
#export TESTBUILD=1

# set to basepath containing your musl-cross toolchains
crosstoolchain=$HOME/musl-cross-4.8.3

# set number of parallel make processes
export MAKE_THREADS=1

# point S to sabotage checkout or /src dir of an existing sabotage install
# path is used to lookup KEEP, pkg and tarballs dirs
#export S=/src
export S=$PWD

# set R to the rootfs path (where stuff gets installed to)
export R=$HOME/x-prefix/$A

# usually, you shouldn't have to change any of these paths
export K=$S/KEEP
# where stuff gets built
export B=$R/src/build
export C=$S/tarballs
export LOGPATH=$R/src/logs
export BUTCHDB=$R/var/lib/butch.db
export butch_filelists=$R/src/filelists/
export butch_tarballs_used=$R/src/tarballs_used.txt
export BUTCH_BUILD_TEMPLATE=$K/butch_template_configure_cached.txt
export BUTCH_DOWNLOAD_TEMPLATE=$K/butch_download_template.txt

[ "$A" = arm ] && eabi=eabi
export PATH="$PATH":$crosstoolchain/$A-linux-musl$eabi/bin

export CC="$A-linux-musl$eabi-gcc -L$R/lib -isystem $R/include"
export CXX="$A-linux-musl$eabi-g++ -L$R/lib -isystem $R/include"
export CROSS_COMPILE=$A-linux-musl$eabi-
export HOSTCC=gcc

export STAGE=1
export PKG_CONFIG_SYSROOT_DIR=$R
export PKG_CONFIG_PATH=$R/lib/pkgconfig
# do not build host/runtime deps
export DEPS=build
